/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lcfgly.database;

import java.util.List;
import java.util.Map;

/**
 * 数据操作扩展接口
 * @author lcfgly
 */
public interface LIDatabaseExt extends LIDatabase{
    
    /**
     * 设置数据库前缀
     * @param prefix 
     */
    void setPrefix(String prefix);
    
    /**
     * 获取数据库前缀
     * @return 
     */
    String getPrefix();
    
    /**
     * 获取一个实例
     * @param <T>
     * @param cs
     * @param where
     * @param args
     * @return
     * @throws LSqlException 
     */
    <T> T one(Class<T> cs,String where,Object... args)throws LSqlException;
    
    /**
     * 获取一组实例
     * @param <T>
     * @param cs
     * @param where
     * @param args
     * @return
     * @throws LSqlException 
     */
    <T> List<T> rows(Class<T> cs,String where,Object... args)throws LSqlException;
    
    /**
     * 更新一个实例
     * @param ob
     * @return
     * @throws LSqlException 
     */
    boolean updateObject(Object ob)throws LSqlException;
    
    /**
     * 更新一个实例
     * @param ob
     * @param where
     * @param args
     * @return
     * @throws LSqlException 
     */
    boolean updateObject(Object ob,String where,Object... args)throws LSqlException;
    
    /**
     * 插入一个实例
     * @param ob
     * @return
     * @throws LSqlException 
     */
    boolean insertObject(Object ob)throws LSqlException;
    
    /**
     * 插入一个实例
     * @param ob
     * @return
     * @throws LSqlException 
     */
    int insertObjectBackId(Object ob)throws LSqlException;
    
    /**
     * 删除一个实例
     * @param ob
     * @return
     * @throws LSqlException 
     */
    boolean deleteObject(Object ob)throws LSqlException;
    
   /**
    * 分页数据
    * @param classtype
    * @param sql
    * @param page
    * @param pagecount
    * @param args
    * @return
    * @throws LSqlException 
    */
    Map Page(String sql, int page, int pagecount, Object... args)throws LSqlException;
    
}
